<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #app {
            width: 800px;
            text-align: center;
            margin: 0 auto;
        }

        #app table,
        #app tr {
            border: 1px solid #000;
        }

        #app td {
            border: 1px solid #000;
        }

        #app th {
            border: 1px solid #000;
        }

        table {
            width: 100%;
        }
    </style>
</head>

<body>

    <div id="app">
        <p>欢迎光临_vue开发的收银系统_水果店</p>
        <table>
            <thead>
                <tr>
                    <th>
                        苹果 10 ￥ / 斤，折扣< 8折>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        请输入你要购买的斤数:
                        <input type="text" name="" id="" v-model="count">
                    </td>
                </tr>
                <tr>
                    <td><button @click="account">结账买单~</button></td>
                </tr>
                <tr>
                    <td>结账单：总价：{{ totalPrice }}￥元 折后价：{{ totalPrice * 0.8 }}￥元 省了：{{ totalPrice - totalPrice * 0.8 }}￥元
                    </td>
                </tr>
            </tbody>
        </table>
    </div>

    <script src="../js/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                count: 0,
                totalPrice: 0
            },
            methods: {
                account() {
                    this.totalPrice = this.count * 10
                }
            }
        })
    </script>

</body>

</html>